package com.anycl.design.j2ee.servicelocator;

/**
 * 上下文对象（提供服务创建）,给服务定位器提供具体的类
 */
public class InitialContext {
    public Service lookUp(String name) {
        if (name.equalsIgnoreCase("serviceA")) {
            return new ServiceA();
        } else if (name.equalsIgnoreCase("serviceB")) {
            return new ServiceB();
        }
        return null;
    }
}
